package com.woniu.controller.component;



import com.woniu.commons.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handleException(Exception e) {
        System.out.println("出现异常:" + e.getMessage());
        e.printStackTrace();
        return new Result("400", "错误提示：" + e.getMessage(), null, null);
    }

}
